<div class="mask-box">
  <%= form_tag("#{save_director_target_admin_targets_path}", remote:true)  do %>
  <div class="mask-head">
    <h4>指标设置</h4>
    <span></span>
  </div>
  <div class="mask-con">
    <div class="mask-marc">
      <ul>
        <li>
          <span>姓名:</span>
          <em><%= @employee.name %></em>
        </li>
        <li>
          <span>月份:</span>
          <em><%= Time.parse(@month).to_s(:friendly)%></em>
          <%= hidden_field_tag :post_id, @post.id %>
          <%= hidden_field_tag :month, @month %>
        </li>
        <li>
          <span>职位:</span>
          <em><%= @post.position_configuration.position_name %></em>
        </li>
        <li class="chi-box">
          <span>指标设置:</span>
          <ul>
            <% @employee_of_studios.each do |es| %>
              <li><%= es.studio.name %></li>
              <li>
                <input type="hidden" id="studio_tag_<%= es.studio_id %>" name=directors_studio[] value='<%= es.studio_id%>' /> 
                <input class="target_zbj" type="" id="target_tag_<%= es.studio_id %>" name=directors_target[] /> <%= @post.position_configuration.position_name == "市场总监" ? "人" : "元" %>
              </li>
            <%end%>
            <li>
              <span>合计：</span>
              <em id="amountT">0</em>
              <span>人</span>
            </li>	
          </ul>
        </li>
      </ul>
    </div>
  </div>
  <div ><%= submit_tag '确认', :class => "mask-confirm" %></div>
  <%end %>  
</div>
<script>
  $(".target_zbj").blur(function() {
    var zbjNum = 0;
    for (var i = 0; i < $(".target_zbj").length; i++) {
      if ($(".target_zbj").eq(i).val() != "") {
        zbjNum += Number($(".target_zbj").eq(i).val());
      };
    };
    $("#amountT").text(zbjNum);
  })
</script>